<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>账号管理</title>
    <link rel="shortcut icon" href="/images/index/logo.ico">
    <style>
        .refresh {
            display: inline-block;
            float: right;
        }

        .form-group {
            margin-bottom: 35px;
        }
    </style>
</head>
<body>
<div class="refresh">
    <button class="btn btn-info search" title="刷新" data-url='/accountAdmin/admin/addinput'><span
            class="glyphicon glyphicon-refresh"></span></button>
</div>
<div class="" style="margin-bottom: 65px;">
    <ol class="breadcrumb">
        <li><a href="javascript:;">账号管理</a></li>
        <li><a data-url="/accountAdmin/admin/list">账号查看和管理</a></li>
        <li class="active">账号添加</li>
    </ol>
</div>
<form class="form-horizontal" method="post" name="form" action="/accountAdmin/admin/add">

    <div class="form-group">
        <label for="account" class="col-sm-2 control-label">账号</label>
        <div class="col-sm-3">
            <input type="text" name="username" class="form-control" id="account" placeholder="账号字数不能大于10,(汉字,英文,数字)"
                   maxlength="10" required onblur="ajax_chech(this,'username')">
        </div>
    </div>
    <div class="form-group">
        <label for="email" class="col-sm-2 control-label">邮箱</label>
        <div class="col-sm-3">
            <input type="email" class="form-control" id="email" name="email" placeholder="邮箱地址" required
                   onblur="ajax_chech(this,'email')">
        </div>
    </div>
    <div class="form-group">
        <label for="phone" class="col-sm-2 control-label">手机号码</label>
        <div class="col-sm-3">
            <input type="tel" class="form-control" id="phone" name="phone" placeholder="手机号码" required
                   onblur="ajax_chech(this,'phone')">
        </div>
    </div>
    <div class="form-group">
        <label for="type" class="col-sm-2 control-label">类型</label>
        <div class="col-sm-3">
            <select name="types" id="type" class="form-control">
                <option value="2">普通用户</option>
                <option value="1">管理用户</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="button" class="btn btn-default submit">确定</button>
        </div>
    </div>
</form>
<script src="/sources/dist/js/jquery.form.js"></script>
<script src="/sources/dist/js/submitForm.js"></script>
<script>
    function ajax_chech(obj, type) {
        var value = $(obj).val();
        $.post("/accountAdmin/admin/check", {type: type, username: value}, function (data) {
            toast_text(data.msg, 2000);
        })
    }

    $(document).ready(function () {
        $('.search').click(function () {
            var scope = $(this).attr('data-url');
            $('.content_right').load(scope);
            toast_text('刷新成功', 600);
        });
        $('.breadcrumb a').click(function () {
            if ($(this).attr('data-url')) {
                $('.content_right').load($(this).attr('data-url'));
            }
        });


    })
    ;
</script>
</body>
</html>